<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Python脚本管理系统</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/common.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/index.css') }}">
</head>
<body>
    <div class="header-nav">
        <h1>Python脚本管理系统</h1>
        <div class="nav-links">
            <a href="{{ url_for('manage_scripts') }}" class="nav-btn">脚本管理</a>
            <a href="{{ url_for('manage_venvs') }}" class="nav-btn">虚拟环境管理</a>
        </div>
    </div>

    {% with messages = get_flashed_messages() %}
        {% if messages %}
        <ul class="flash-messages">
            {% for message in messages %}
            <li class="flash-message">{{ message }}</li>
            {% endfor %}
        </ul>
        {% endif %}
    {% endwith %}

    <div class="container">
        <h2>添加新脚本</h2>
        <form action="{{ url_for('add_script') }}" method="post" enctype="multipart/form-data" id="uploadForm">
            <div class="form-group">
                <label for="name">脚本名称:</label>
                <input type="text" id="name" name="name" required>
            </div>
            <div class="form-group">
                <label>脚本文件或文件夹:</label>
                <div class="file-upload-container" id="dropZone">
                    <div class="upload-instructions">
                        拖放文件或文件夹到这里，或点击选择文件<br>
                        <small>支持上传单个.py文件或包含Python文件的文件夹</small>
                    </div>
                    <input type="file" id="script_file" name="script_file" multiple webkitdirectory directory style="display: none;">
                    <div class="file-list" id="fileList"></div>
                    <div class="file-count" id="fileCount"></div>
                </div>
            </div>
            <div class="form-group">
                <label for="venv">虚拟环境:</label>
                <div class="venv-select-group">
                    <select id="venv" name="venv">
                        <option value="">使用系统Python</option>
                        {% for venv in venvs %}
                        <option value="{{ venv }}">{{ venv }} (内置)</option>
                        {% endfor %}
                    </select>
                </div>
            </div>
            <button type="submit">上传脚本</button>
        </form>
    </div>

    <script src="{{ url_for('static', filename='js/index.js') }}"></script>
</body>
</html> 